package com.zndroid.gridview.load.impl;

import android.content.Context;
import android.widget.ImageView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.zndroid.gridview.IImageBean;
import com.zndroid.gridview.load.IImageDisplayEngine;
import com.zndroid.gridview.load.ILoadCallBack;
import com.zndroid.gridview.load.Loader;

public final class LocalFileLoader extends Loader {

    @Override
    public void load(@NonNull Context context, @NonNull ImageView imageView, @NonNull IImageDisplayEngine engine, @NonNull IImageBean bean, @Nullable ILoadCallBack loadCallBack) {
        if (bean.supplyFile().exists()) {
            engine.onDisplayImage(context, imageView, bean.supplyFile(), loadCallBack);
        } else {
            nextLoader.load(context, imageView, engine, bean, loadCallBack);
        }
    }
}
